//
//  CommonMarc.swift
//  YUANSHI
//
//  Created by pro on 2019/12/31.
//  Copyright © 2019 wangbin. All rights reserved.
//

import UIKit


// cache文件路径
let cachesPath: String = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).last!

//屏幕高
public let kSCREEN_HEIGHT  = UIScreen.main.bounds.size.height

//屏幕宽
public let kSCREEN_WIDTH  = UIScreen.main.bounds.size.width

//公共左右距离
public let KCommomPaddingLeft:CGFloat = 10.0 as CGFloat

//提交按钮的高
public let KCommomSubmitBtn:CGFloat = 40 as CGFloat

//输入框的高
public let KCommomTextH:CGFloat = 45 as CGFloat

// MARK: - ViewW
func kViewWidth (v:UIView) -> CGFloat
{
    return v.frame.size.width
}
// MARK: - ViewH
func kViewHeight (v:UIView) -> CGFloat
{
    return v.frame.size.height
}
// MARK: - ViewX
func kViewX (v:UIView) -> CGFloat
{
    return v.frame.origin.x
}
// MARK: - ViewY
func kViewY (v:UIView) -> CGFloat
{
    return v.frame.origin.y
}
// MARK: - ViewXW
func kViewRight (v:UIView) -> CGFloat
{
    return v.frame.origin.x + v.frame.size.width
}
// MARK: - ViewYH
func kViewBottom (v:UIView) -> CGFloat
{
    return v.frame.origin.y + v.frame.size.height
}



//应用程序信息
let infoDictionary = Bundle.main.infoDictionary!
let appDisplayName = infoDictionary["CFBundleDisplayName"] //程序名称
let majorVersion = infoDictionary["CFBundleShortVersionString"]//主程序版本号
let minorVersion = infoDictionary["CFBundleVersion"]//版本号（内部标示）
let appVersion = majorVersion as! String

//分页数据 10条
public let kComPageNum:NSInteger = 10 as NSInteger

struct ScreenInfo {
    static let Frame = UIScreen.main.bounds
    static let Height = Frame.height
    static let Width = Frame.width
    static let navigationHeight:CGFloat = navBarHeight()
    
    static func isIphoneX() -> Bool {
        return UIScreen.main.bounds.equalTo(CGRect(x: 0, y: 0, width: 375, height: 812))
    }
    static private func navBarHeight() -> CGFloat {
        return isIphoneX() ? 88 : 64
    }
}
//便捷的类方法
extension UIColor {
    class func colorWithRGBA(r:CGFloat,g:CGFloat,b:CGFloat,a:CGFloat) -> UIColor {
        return UIColor(red: r/255, green: g/255, blue: b/255, alpha: a)
    }
}

